var menus = [{
        hash: '#home',
        path: 'view/home',
        bind: 'vm/home',
        level: '1',
        requireLogin: true,
        checkSIMStatus: true
    },
    {
        hash: '#wifiUsers',
        path: 'view/wifi_users',
        bind: 'vm/wifi_users',
        level: '1',
        requireLogin: true,
        checkSIMStatus: true
    },
    {
        hash: '#sms_router',
        path: 'view/sms/router',
        bind: 'vm/sms/router',
        level: '1',
        requireLogin: true,
        checkSIMStatus: true
    },
    {
        hash: '#sms_sim',
        path: 'view/sms/sim',
        bind: 'vm/sms/sim',
        level: '1',
        requireLogin: true,
        checkSIMStatus: true
    },
    {
        hash: '#sms_settings',
        path: 'view/sms/settings',
        bind: 'vm/sms/settings',
        level: '1',
        requireLogin: true,
        checkSIMStatus: true
    },
    {
        hash: '#ussd',
        path: 'view/ussd',
        bind: 'vm/ussd',
        level: '1',
        requireLogin: false,
        checkSIMStatus: false
    },
    {
        hash: '#ota_update',
        path: 'view/update',
        bind: 'vm/update',
        level: '1',
        requireLogin: false,
        checkSIMStatus: false
    },
    /** settings start **/
    {
        hash: '#settings_switched_dialup',
        path: 'view/settings/switched/dialup',
        checkSIMStatus: true
    },
    {
        hash: '#settings_switched_network',
        path: 'view/settings/switched/network',
        checkSIMStatus: true
    },
    {
        hash: '#settings_switched_apn',
        path: 'view/settings/switched/apn',
        checkSIMStatus: true
    },
    {
        hash: '#settings_wifi_basic',
        path: 'view/settings/wifi/basic'
    },
    {
        hash: '#settings_wifi_advanced',
        path: 'view/settings/wifi/advanced'
    },
    {
        hash: '#settings_wifi_wps',
        path: 'view/settings/wifi/wps'
    },
    {
        hash: '#settings_wifi_black',
        path: 'view/settings/wifi/black'
    },
    {
        hash: '#settings_system_account',
        path: 'view/settings/system/account'
    },
    {
        hash: '#settings_system_pin',
        path: 'view/settings/system/pin',
        checkSIMStatus: true
    },
    {
        hash: '#settings_system_reset',
        path: 'view/settings/system/reset'
    },
    {
        hash: '#settings_system_shutdown',
        path: 'view/settings/system/shutdown'
    },
    {
        hash: '#settings_system_restart',
        path: 'view/settings/system/restart'
    },
    {
        hash: '#settings_system_power',
        path: 'view/settings/system/power'
    },
    {
        hash: '#settings_system_fast_boot',
        path: 'view/settings/system/fast_boot'
    },
    {
        hash: '#settings_security_filtering',
        path: 'view/settings/security/filtering'
    },
    {
        hash: '#settings_security_mapping',
        path: 'view/settings/security/mapping'
    },
    {
        hash: '#settings_security_upnp',
        path: 'view/settings/security/upnp'
    },
    {
        hash: '#settings_security_dmz',
        path: 'view/settings/security/dmz'
    },
    {
        hash: '#settings_system_security',
        path: 'view/settings/security/system_security'
    },
    {
        hash: '#settings_system_router',
        path: 'view/settings/router'
    },
    {
        hash: '#settings_info',
        path: 'view/settings/information'
    },
    {
        hash: '#settings_traffic_statistics',
        path: 'view/settings/traffic/statistics'
    },
    {
        hash: '#settings_traffic_alert',
        path: 'view/settings/traffic/traffic_alert'
    },
    {
        hash: '#settings_phonebook',
        path: 'view/settings/phonebook'
    },
    {
        hash: '#settings_phonebook_common',
        path: 'view/settings/phonebook'
    },
    {
        hash: '#settings_phonebook_family',
        path: 'view/settings/phonebook'
    },
    {
        hash: '#settings_phonebook_friend',
        path: 'view/settings/phonebook'
    },
    {
        hash: '#settings_phonebook_colleague',
        path: 'view/settings/phonebook'
    },
    {
        hash: '#mbb_app',
        path: 'view/jazz_wifiapp'
    },
]

window.findMenu = function(hashVal) {
    hashVal = hashVal || window.location.hash;
    if (hashVal.indexOf('#settings_') == 0) {
        return [{
            path: 'view/settings/index'
        }];
    }
    if (hashVal.indexOf('#sms_') == 0) {
        return [{
            path: 'view/sms/index'
        }];
    }

    var matchMenu = menus.filter(function(value) {
        return value.hash == hashVal
    })
    return matchMenu
}
window.findSettingsMenu = function(topic) {
    var matchMenu = menus.filter(function(value) {
        return value.hash == topic
    })
    return matchMenu
}